/* This is the info panel at the bottom right of the UI
 * 
 */

package gui.battle;

import item.ship.Ship;

import javax.swing.*;

import java.awt.*;

public class InfoPanel extends JPanel {
	
	public InfoPanel(Ship s){
		
		this.setMaximumSize(new Dimension(300, 100));
		
		JLabel nameL = new JLabel("Ship Name: "); //label for name
		JLabel classL = new JLabel("Ship Class: "); //label for ship class
		JLabel hullL = new JLabel("Hull: "); //label for hull
		JLabel armorL = new JLabel("Armor: "); //label for armor
		JLabel shieldL = new JLabel("Shield: "); //label for shields
		
		JLabel nameD = new JLabel(s.getName()); //the name
		JLabel classD = new JLabel(s.getShipClass()); //the class
		JLabel hullD = new JLabel(s.getHull() + "/" + s.getMaxHull()); //the hull
		JLabel armorD = new JLabel(s.getArmor() + "/" + s.getMaxArmor()); //the armor
		JLabel shieldD = new JLabel(s.getShields() + "/" + s.getMaxShields()); //the shields
		
		JPanel container = new JPanel(); //used to hold all the actual information
		container.setLayout(new GridLayout(3, 1, 0, 10));
		
		this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		
		JPanel nameP = new JPanel(); //the panel for the name
		nameP.setLayout(new BoxLayout(nameP, BoxLayout.X_AXIS));
		nameP.add(nameL);
		nameP.add(nameD);
		
		JPanel classP = new JPanel(); //the panel for the name
		classP.setLayout(new BoxLayout(classP, BoxLayout.X_AXIS));
		classP.add(classL);
		classP.add(classD);
		
		JPanel infoP = new JPanel();
		
		infoP.setLayout(new BoxLayout(infoP, BoxLayout.X_AXIS));
		
		JPanel hullP = new JPanel(); //the panel for the name
		hullP.setLayout(new BoxLayout(hullP, BoxLayout.X_AXIS));
		hullP.add(hullL);
		hullP.add(hullD);
		
		JPanel armorP = new JPanel(); //the panel for the name
		armorP.setLayout(new BoxLayout(armorP, BoxLayout.X_AXIS));
		armorP.add(armorL);
		armorP.add(armorD);

		JPanel shieldP = new JPanel(); //the panel for the name
		shieldP.setLayout(new BoxLayout(shieldP, BoxLayout.X_AXIS));
		shieldP.add(shieldL);
		shieldP.add(shieldD);

		infoP.add(hullP);
		infoP.add(Box.createHorizontalGlue());
		infoP.add(armorP);
		infoP.add(Box.createHorizontalGlue());
		infoP.add(shieldP);
		
		container.add(nameP);
		container.add(classP);
		container.add(infoP);
		
		this.add(container);		
	}//InfoPanel
}//InfoPanel
